﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace StorageManager
{
    public partial class ContainerPropertyControl : UserControl
    {
        public ContainerPropertyControl()
        {
            InitializeComponent();
        }

        public void ShowProperties(long size, int blobCount)
        {
            String sizetext = "{0} {1}";
            if (size < 1024)
            {
                sizetext = String.Format(sizetext, size, "bytes");
            }
            else if (size < 1048576)
            {
                sizetext = String.Format(sizetext, Math.Ceiling(size / 1024d), "KB");
            }
            else
            {
                sizetext = String.Format(sizetext, Math.Ceiling(size / 1048576d), "MB");
            }
            lblSizeValue.Text = sizetext;

            lblBlobCountValue.Text = blobCount.ToString();
        }

        public void ClearProperties()
        {
            lblSizeValue.Text = String.Empty;
            lblBlobCountValue.Text = String.Empty;
        } 
    }
}
